/*
 * commons is a based project implemented
 * Copyright (C) 2024 Jasmine
 */
package com.commons.core.domain.pojo;

import java.io.Serial;
import java.io.Serializable;

import io.swagger.v3.oas.annotations.media.Schema;

/**
 * 查询公共请求对象
 *
 * @author Jasmine
 * @version 1.0
 * @description
 * @date 2022-12-05 14:43:43
 * @see Query
 * @since JDK11
 */
public class Query implements Serializable {
    public static final int DEFAULT_PAGE_SIZE = 10;
    @Serial
    private static final long serialVersionUID = 3642600756355937123L;

    @Schema(description = "页码，从0开始")
    private int pageNum = 0;
    @Schema(description = "页面大小")
    private int pageSize = DEFAULT_PAGE_SIZE;

    /**
     * POST 请求 {"orders":["createTime,asc","updateTime,DESC"] } <br/>
     * GET 请求 http://localhost:8080/test?orders=createTime,desc&orders=updateTime,asc
     */
    @Schema(description = "排序字段", example = "['createTime,desc', 't1.updateTime,asc']")
    private String[] orders;

    /*@Schema(description = "排序(GET请求)", example = "updateTime:DESC,createTime:asc")
    private String orderBy = "updateTime:DESC";
    
    @Schema(description = "排序字段列表(POST请求)")
    private List<Order> orderList;*/

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public String[] getOrders() {
        return orders;
    }

    public void setOrders(String[] orders) {
        this.orders = orders;
    }
}
